<?php
    session_start();
?>
<!DOCTYPE html>
<html>
    <head>
		<meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="./style.css">
        <script type="text/javascript"
            src="https://maps.googleapis.com/maps/api/js?
                 key=AIzaSyCsTHUfyC8gRQBvZ3O-SpoFhvKa7OTREwc&sensor=false&language=bg&region=bg&libraries=drawing">
        </script>
        <script type="text/javascript" src="./jscript.js"></script>
    </head>
    <body>
        <div id=left class="addedit">
            <form method="post" action="submitedit.php">
                <div class="formelems">
                    <?php $_SESSION['gobjId'] = $_GET['gobjId']; ?>
                    <input type="hidden" name="gobjId" value="<?php $_GET['gobjId']?>" />
                </div>
                <div class="formelems">
                    Име <input type="text" size="51" name="name" class="formallign" value="<?php $_SESSION['name']?>" placeholder="Име на обекта" autofocus required  /><br/>
                </div>
                <div class="formelems">
                    Координати <input type="text" size="51" name="coords" class="formallign" value="<?php $_SESSION['coords']?>" placeholder="Нарисувайте го на картата." readonly/> <br/>
                </div>
                <div class="nodis">
                    <input type="text" name="submit" size="80" required/> <br/>
                </div>
                <div class="formelems">
                    Description <textarea name="descr" rows="10" cols="50" class="formallign" value="<?php $_SESSION['descr']?>" placeholder="Кратко описание. Не е задължително."></textarea> </br>
                </div>
                <input id="submit" type="submit" value="Промени" class="admin"/>
                <button id="reset" type="button" class="admin" onclick="resetform()"> Забрави </button>
                <button id="cancel" type="button" class="admin" onclick="cancelform()"> Отказ </button>
                <?php
                    if (isset($_SESSION['name']) && isset($_SESSION['coords']) && isset($_SESSION['descr'])) {
                        echo '<input id="hname" type="text" name="oldname" class="nodis" value="' . $_SESSION['name'] . '"/>
                              <input id="hcoords" type="text" name="oldcoords" class="nodis" value="' . $_SESSION['coords'] . '"/>
                              <input id="hdescr" type="text" name="olddescr" class="nodis" value="' . $_SESSION['descr'] . '"/>';
                    }
                ?>
            </form>
        </div>
        <div id="map-canvas" class="addedit"/>
    </body>
</html>